﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class shop_HotSpot_Manager : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            Utility.InitUltraWebGrid.InitDisplayLayOut(this.UWG);

            if (_Site != null)
            {
                tSiteID.Text = _Customer.ShopID.ToString();
            }
            BindData();
        }
    }

    private void BindData()
    {
        long ShopID = Shove._Convert.StrToLong(tSiteID.Text, 0);
        DataTable dt = new DAL.Tables.tbl_Site_HotSpot().Open("", "ShopID=" + ShopID, "");

        if (dt == null)
        {
            PublicFunction.GoError(ErrorNumber.NoData, "暂无您需要的数据", "HotSpot_Manager");
        }

        this.UWG.DataSource = dt;
        this.UWG.DataBind();
    }

    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Response.Redirect("HotSpot_Edit.aspx?Action=Add");
    }

    protected void btnEdit_Click(object sender, EventArgs e)
    {
        string ID = this.hID.Value;

        if (ID != "")
        {
            Response.Redirect("HotSpot_Edit.aspx?Action=Edit&ID=" + ID + "");
        }
    }

    protected void btnDelete_Click(object sender, EventArgs e)
    {
        string ID = this.hID.Value;

        if (ID != "")
        {
            new DAL.Tables.tbl_Site_HotSpot().Delete("ID="+ID);

            this.hID.Value = "";
            Response.Redirect("HotSpot_Manager.aspx");
        }
    }

    protected void UWG_PageIndexChanged(object sender, Infragistics.WebUI.UltraWebGrid.PageEventArgs e)
    {
        BindData();
    }
}
